export default {
  data() {
    return {
      menuList: [],
      collapse: false,
      iconlist: ['icon-users', 'icon-tijikongjian', 'icon-shangpin', 'icon-danju', 'icon-baobiao'],
      activePath: ''
    }
  },
  created() {
    this.getMenus()
    this.activePath = this.$route.path
  },
  methods: {
    logout() {
      window.sessionStorage.clear('token')
      this.$router.push('/login')
    },
    async getMenus() {
      const { data: res } = await this.$http.get('menus')
      if (res.meta.status !== 200) return this.$message.error('获取左侧菜单失败')
      this.menuList = res.data
    },
    setActivePath(path) {
      this.activePath = path
    }
  }
}
